﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MonsterEngine.Interfaces;
using MonsterEngine.Abilities;
using MonsterEngine.Types;

namespace MonsterEngine.Managers
{
    public class AbilityManager
    {
        
        public AbilityManager()
        { 
        }

        /// <summary>
        /// For display only...no one will get all abilities when creating a toon.
        /// This will need to go away once inserted into database.
        /// </summary>
        /// <returns></returns>
        public List<IAbilities> BuildAllAbilities()
        {
            List<IAbilities> abilList = new List<IAbilities>();

            Heal heal = new Heal();
            heal.AbilityType = AbilityType.Heal;
            heal.BasePoint = 3;
            heal.Name = "3pt heal";
            heal.AbilityKey = 1;
            heal.DamageType = DamageType.None;
            abilList.Add(heal);

            DamagePlus plusTwo = new DamagePlus();
            plusTwo.AbilityType = AbilityType.Attack;
            plusTwo.BasePoint = 2;
            plusTwo.Name = "Plus 2!";
            plusTwo.AbilityKey = 2;
            plusTwo.DamageType = DamageType.Physical;
            abilList.Add(plusTwo);

            HealthSteal hSteal = new HealthSteal();
            hSteal.AbilityType = AbilityType.Support;
            hSteal.BasePoint = 0;
            hSteal.Name = "Health Steal";
            hSteal.AbilityKey = 3;
            hSteal.DamageType = DamageType.Magical;
            abilList.Add(hSteal);

            Sleep sleep = new Sleep();
            sleep.AbilityType = AbilityType.Support;
            sleep.BasePoint = 0;
            sleep.Name = "Sleep";
            sleep.AbilityKey = 4;
            sleep.DamageType = DamageType.Magical;
            abilList.Add(sleep);

            LifeDrip drip = new LifeDrip();
            drip.AbilityType = AbilityType.Heal;
            drip.BasePoint = 1;
            drip.Name = "Life Drip";
            drip.AbilityKey = 5;
            drip.DamageType = DamageType.Magical;
            abilList.Add(drip);

            return abilList;
        }

        public void UseAbility(IFightable player1, IFightable player2, IAbilities useAbility)
        {
            switch (useAbility.AbilityType)
            {
                case AbilityType.Attack:
                    Console.WriteLine(player1.Name + " used attack ability " + useAbility.Name + "...");
                    break;
                case AbilityType.Heal:
                    Console.WriteLine(player1.Name + " used heal ability " + useAbility.Name + "...");
                    break;
                case AbilityType.Support:
                    Console.WriteLine(player1.Name + " used support ability " + useAbility.Name + "...");
                    break;
                default:
                    break;
            }
            useAbility.DoAbility();
        }

      
    }
}
